<?php 
/**
 * 货品列表模型
 */
class GoodListModel extends Model{
    public $table = 'goods_list';
    
    public $auto = array(
		array('spec','_spec','method',2,3),
	);
	
	public function _spec($value){
	    $value = implode(',', $value);
		return $value;
	}
    
    public $validate = array(
		array('inventory','nonull','库存不能为空',2,3),
		array('number','nonull','货号不能为空',2,3),
	);
    
    public function addData(){
        if(!$this->create()) return false;
		$this->data['combine']=$this->data['spec'];
		$this->data['goods_gid']=$_POST['gid'];
		return $this->add();
    }
	
	
	public function editData($glid){
        if(!$this->create()) return false;
		$this->data['combine']=$this->data['spec'];
		$this->data['goods_gid']=$_POST['gid'];
		return $this->where("glid={$glid}")->update();
    }
	
 }
 
 
 
 
 
 
 
 
 
 
 



 ?>